package com.yic.module.qms.api.inspectprocess;

import com.yic.module.qms.api.inspectprocess.dto.InspectProcessCreateReqDTO;
import com.yic.module.qms.api.inspectprocess.dto.InspectProcessRespDTO;
import com.yic.module.qms.controller.admin.inspectinfo.vo.InspectInfoCreateReqVO;
import com.yic.module.qms.controller.admin.inspectprocess.vo.InspectProcessCreateReqVO;
import com.yic.module.qms.convert.inspectinfo.InspectInfoConvert;
import com.yic.module.qms.convert.inspectprocess.InspectProcessConvert;
import com.yic.module.qms.dal.dataobject.inspectprocess.InspectProcessDO;
import com.yic.module.qms.service.inspectprocess.InspectProcessService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: Ljx
 * @createTime: 2023年12月07日 13:36:19
 * @version: v1.0.0
 * @Description: 过程检验单实现类
 */
@Service
public class InspectProcessApiImpl implements InspectProcessApi{

    @Resource
    private InspectProcessService inspectProcessService;

    @Override
    public void saveInspectProcess(InspectProcessCreateReqDTO req) {
        InspectProcessCreateReqVO createReqVO = InspectProcessConvert.INSTANCE.convert(req);
        List<InspectInfoCreateReqVO> entryList = InspectInfoConvert.INSTANCE.convertList04(req.getEntryList());
        createReqVO.setEntryList(entryList);
        inspectProcessService.createInspectProcess(createReqVO);
    }

    @Override
    public List<InspectProcessRespDTO> getInspectProcessList(Long moId, Long processId) {
        List<InspectProcessDO> list = inspectProcessService.getInspectProcessList(moId, processId);
        return InspectProcessConvert.INSTANCE.convertList03(list);
    }

}
